<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>gdsl: gdsl_hash.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">gdsl
   &#160;<span id="projectnumber">1.7</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>Globals</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('gdsl__hash_8h.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">gdsl_hash.h</div>  </div>
</div><!--header-->
<div class="contents">
<a href="gdsl__hash_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * This file is part of the Generic Data Structures Library (GDSL).</span>
<a name="l00003"></a>00003 <span class="comment"> * Copyright (C) 1998-2006 Nicolas Darnis &lt;ndarnis@free.fr&gt;.</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * The GDSL library is free software; you can redistribute it and/or </span>
<a name="l00006"></a>00006 <span class="comment"> * modify it under the terms of the GNU General Public License as </span>
<a name="l00007"></a>00007 <span class="comment"> * published by the Free Software Foundation; either version 2 of</span>
<a name="l00008"></a>00008 <span class="comment"> * the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * The GDSL library is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00013"></a>00013 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00016"></a>00016 <span class="comment"> * along with the GDSL library; see the file COPYING.</span>
<a name="l00017"></a>00017 <span class="comment"> * If not, write to the Free Software Foundation, Inc., </span>
<a name="l00018"></a>00018 <span class="comment"> * 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.</span>
<a name="l00019"></a>00019 <span class="comment"> *</span>
<a name="l00020"></a>00020 <span class="comment"> * $RCSfile: gdsl__hash_8h_source.html,v $</span>
<a name="l00021"></a>00021 <span class="comment"> * $Revision: 1.3 $</span>
<a name="l00022"></a>00022 <span class="comment"> * $Date: 2013/06/12 16:36:13 $</span>
<a name="l00023"></a>00023 <span class="comment"> */</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="preprocessor">#ifndef _GDSL_HASH_H_</span>
<a name="l00027"></a>00027 <span class="preprocessor"></span><span class="preprocessor">#define _GDSL_HASH_H_</span>
<a name="l00028"></a>00028 <span class="preprocessor"></span>
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 
<a name="l00033"></a>00033 <span class="preprocessor">#include &quot;<a class="code" href="gdsl__types_8h.html">gdsl_types.h</a>&quot;</span>
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 
<a name="l00036"></a>00036 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00037"></a>00037 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> 
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
<a name="l00040"></a>00040 
<a name="l00041"></a>00041 
<a name="l00054"></a><a class="code" href="group__gdsl__hash.html#gae145ec3ea3d118dcc593ab7902162cd2">00054</a> <span class="keyword">typedef</span> <span class="keyword">struct </span>hash_table* <a class="code" href="group__gdsl__hash.html#gae145ec3ea3d118dcc593ab7902162cd2" title="GDSL hashtable type.">gdsl_hash_t</a>;
<a name="l00055"></a>00055 
<a name="l00062"></a><a class="code" href="group__gdsl__hash.html#ga9198c4e32d387180450fa57d7e29515d">00062</a> <span class="keyword">typedef</span> <span class="keyword">const</span> <span class="keywordtype">char</span>* (*gdsl_key_func_t) (<span class="keywordtype">void</span>* VALUE
<a name="l00063"></a>00063                     );
<a name="l00064"></a>00064 
<a name="l00070"></a><a class="code" href="group__gdsl__hash.html#gab53a567436929e68661a337d7c3b20a0">00070</a> <span class="keyword">typedef</span> <a class="code" href="group__gdsl__types.html#ga9c34ac44da309b004570530c8cec8a0e">ulong</a> (*<a class="code" href="group__gdsl__hash.html#gab53a567436929e68661a337d7c3b20a0" title="GDSL hashtable hash function type.">gdsl_hash_func_t</a>) (<span class="keyword">const</span> <span class="keywordtype">char</span>* KEY
<a name="l00071"></a>00071                    );
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 <span class="comment">/******************************************************************************/</span>
<a name="l00074"></a>00074 <span class="comment">/* Generic hash function                                                      */</span>
<a name="l00075"></a>00075 <span class="comment">/******************************************************************************/</span>
<a name="l00076"></a>00076 
<a name="l00087"></a>00087 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga9c34ac44da309b004570530c8cec8a0e">ulong</a>
<a name="l00088"></a>00088 <a class="code" href="group__gdsl__hash.html#gafb96675c3097a359e962bca36a11a528" title="Computes a hash value from a NULL terminated character string.">gdsl_hash</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* KEY
<a name="l00089"></a>00089        );
<a name="l00090"></a>00090 
<a name="l00091"></a>00091 <span class="comment">/******************************************************************************/</span>
<a name="l00092"></a>00092 <span class="comment">/* Management functions of hashtables                                         */</span>
<a name="l00093"></a>00093 <span class="comment">/******************************************************************************/</span>
<a name="l00094"></a>00094 
<a name="l00127"></a>00127 <span class="keyword">extern</span> gdsl_hash_t
<a name="l00128"></a>00128 <a class="code" href="group__gdsl__hash.html#gae19c5647d31f3d8f88b988e89609049c" title="Create a new hashtable.">gdsl_hash_alloc</a> (<span class="keyword">const</span> <span class="keywordtype">char</span>* NAME,
<a name="l00129"></a>00129          <a class="code" href="group__gdsl__types.html#ga32a9b4e8b9665183c2741d28a5ced64f" title="GDSL Alloc element function type.">gdsl_alloc_func_t</a> ALLOC_F,
<a name="l00130"></a>00130          <a class="code" href="group__gdsl__types.html#ga2c6b3f96b291b5b39d2799f93e350053" title="GDSL Free element function type.">gdsl_free_func_t</a> FREE_F,
<a name="l00131"></a>00131          <a class="code" href="group__gdsl__hash.html#ga9198c4e32d387180450fa57d7e29515d" title="GDSL hashtable key function type.">gdsl_key_func_t</a> KEY_F,
<a name="l00132"></a>00132          <a class="code" href="group__gdsl__hash.html#gab53a567436929e68661a337d7c3b20a0" title="GDSL hashtable hash function type.">gdsl_hash_func_t</a> HASH_F,
<a name="l00133"></a>00133          <a class="code" href="group__gdsl__types.html#ga3fa7784c89589b49764048e9909d0e07">ushort</a> INITIAL_ENTRIES_NB
<a name="l00134"></a>00134          );
<a name="l00135"></a>00135 
<a name="l00149"></a>00149 <span class="keyword">extern</span> <span class="keywordtype">void</span>
<a name="l00150"></a>00150 <a class="code" href="group__gdsl__hash.html#ga3723a6cfb3338b7e312d3e2f161f0692" title="Destroy a hashtable.">gdsl_hash_free</a> (gdsl_hash_t H
<a name="l00151"></a>00151         );
<a name="l00152"></a>00152 
<a name="l00166"></a>00166 <span class="keyword">extern</span> <span class="keywordtype">void</span>
<a name="l00167"></a>00167 <a class="code" href="group__gdsl__hash.html#gac047b5a4899747159dbaf44b39b7daeb" title="Flush a hashtable.">gdsl_hash_flush</a> (gdsl_hash_t H
<a name="l00168"></a>00168          );
<a name="l00169"></a>00169 
<a name="l00170"></a>00170 <span class="comment">/******************************************************************************/</span>
<a name="l00171"></a>00171 <span class="comment">/* Consultation functions of hashtables                                       */</span>
<a name="l00172"></a>00172 <span class="comment">/******************************************************************************/</span>
<a name="l00173"></a>00173 
<a name="l00183"></a>00183 <span class="keyword">extern</span> <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00184"></a>00184 <a class="code" href="group__gdsl__hash.html#ga199e08c06af60e688d95244a023f406d" title="Get the name of a hashtable.">gdsl_hash_get_name</a> (<span class="keyword">const</span> gdsl_hash_t H
<a name="l00185"></a>00185             );
<a name="l00186"></a>00186 
<a name="l00196"></a>00196 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga3fa7784c89589b49764048e9909d0e07">ushort</a>
<a name="l00197"></a>00197 <a class="code" href="group__gdsl__hash.html#gad87fd81a7853bdcfe2cc7fdd142556f0" title="Get the number of entries of a hashtable.">gdsl_hash_get_entries_number</a> (<span class="keyword">const</span> gdsl_hash_t H
<a name="l00198"></a>00198                   );
<a name="l00199"></a>00199 
<a name="l00214"></a>00214 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga3fa7784c89589b49764048e9909d0e07">ushort</a>
<a name="l00215"></a>00215 <a class="code" href="group__gdsl__hash.html#ga5d9b8da0f4ad5e60b7fdb38156ce48f3" title="Get the max number of elements allowed in each entry of a hashtable.">gdsl_hash_get_lists_max_size</a> (<span class="keyword">const</span> gdsl_hash_t H
<a name="l00216"></a>00216                   );
<a name="l00217"></a>00217 
<a name="l00229"></a>00229 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga3fa7784c89589b49764048e9909d0e07">ushort</a>
<a name="l00230"></a>00230 <a class="code" href="group__gdsl__hash.html#gad89e4fe4756aa34a0f47948819e53682" title="Get the number of elements of the longest list entry of a hashtable.">gdsl_hash_get_longest_list_size</a> (<span class="keyword">const</span> gdsl_hash_t H
<a name="l00231"></a>00231                  );
<a name="l00232"></a>00232 
<a name="l00243"></a>00243 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga9c34ac44da309b004570530c8cec8a0e">ulong</a>
<a name="l00244"></a>00244 <a class="code" href="group__gdsl__hash.html#ga9f9bd328f3237d333a7d7bab5285aa2d" title="Get the size of a hashtable.">gdsl_hash_get_size</a> (<span class="keyword">const</span> gdsl_hash_t H
<a name="l00245"></a>00245             );
<a name="l00246"></a>00246 
<a name="l00257"></a>00257 <span class="keyword">extern</span> <span class="keywordtype">double</span>
<a name="l00258"></a>00258 <a class="code" href="group__gdsl__hash.html#ga6c858e792ee64ce14bfeb0e7c03d3e42" title="Get the fill factor of a hashtable.">gdsl_hash_get_fill_factor</a> (<span class="keyword">const</span> gdsl_hash_t H
<a name="l00259"></a>00259                );
<a name="l00260"></a>00260 
<a name="l00261"></a>00261 <span class="comment">/******************************************************************************/</span>
<a name="l00262"></a>00262 <span class="comment">/* Modification functions of hashtables                                       */</span>
<a name="l00263"></a>00263 <span class="comment">/******************************************************************************/</span>
<a name="l00264"></a>00264   
<a name="l00278"></a>00278 <span class="keyword">extern</span> gdsl_hash_t
<a name="l00279"></a>00279 <a class="code" href="group__gdsl__hash.html#gac46d87b7312a26b985709a904a2f452e" title="Set the name of a hashtable.">gdsl_hash_set_name</a> (gdsl_hash_t H,
<a name="l00280"></a>00280             <span class="keyword">const</span> <span class="keywordtype">char</span>* NEW_NAME
<a name="l00281"></a>00281             );
<a name="l00282"></a>00282 
<a name="l00312"></a>00312 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga0e2b9d7fb5ca9e6d50100e5d9e4bcae7" title="GDSL element type.">gdsl_element_t</a>
<a name="l00313"></a>00313 <a class="code" href="group__gdsl__hash.html#ga98ae1fcdb6908b699056e131357d837b" title="Insert an element into a hashtable (PUSH).">gdsl_hash_insert</a> (gdsl_hash_t H,
<a name="l00314"></a>00314           <span class="keywordtype">void</span>* VALUE
<a name="l00315"></a>00315           );
<a name="l00316"></a>00316   
<a name="l00333"></a>00333 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga0e2b9d7fb5ca9e6d50100e5d9e4bcae7" title="GDSL element type.">gdsl_element_t</a>
<a name="l00334"></a>00334 <a class="code" href="group__gdsl__hash.html#ga2e7d31f45b959fe14badc3b620a8de5e" title="Remove an element from a hashtable (POP).">gdsl_hash_remove</a> (gdsl_hash_t H,
<a name="l00335"></a>00335           <span class="keyword">const</span> <span class="keywordtype">char</span>* KEY
<a name="l00336"></a>00336           );
<a name="l00354"></a>00354 <span class="keyword">extern</span> gdsl_hash_t
<a name="l00355"></a>00355 <a class="code" href="group__gdsl__hash.html#ga94dfde405aae321e2c3d02d3c260bfcb" title="Delete an element from a hashtable.">gdsl_hash_delete</a> (gdsl_hash_t H,
<a name="l00356"></a>00356           <span class="keyword">const</span> <span class="keywordtype">char</span>* KEY
<a name="l00357"></a>00357           );
<a name="l00358"></a>00358 
<a name="l00387"></a>00387 <span class="keyword">extern</span> gdsl_hash_t
<a name="l00388"></a>00388 <a class="code" href="group__gdsl__hash.html#ga56acbd8af54ef98000d1749afbb28234" title="Increase the dimensions of a hashtable.">gdsl_hash_modify</a> (gdsl_hash_t H, 
<a name="l00389"></a>00389           <a class="code" href="group__gdsl__types.html#ga3fa7784c89589b49764048e9909d0e07">ushort</a> NEW_ENTRIES_NB, 
<a name="l00390"></a>00390           <a class="code" href="group__gdsl__types.html#ga3fa7784c89589b49764048e9909d0e07">ushort</a> NEW_LISTS_MAX_SIZE
<a name="l00391"></a>00391           );
<a name="l00392"></a>00392 
<a name="l00393"></a>00393 <span class="comment">/******************************************************************************/</span>
<a name="l00394"></a>00394 <span class="comment">/* Search functions of hashtables                                             */</span>
<a name="l00395"></a>00395 <span class="comment">/******************************************************************************/</span>
<a name="l00396"></a>00396 
<a name="l00412"></a>00412 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga0e2b9d7fb5ca9e6d50100e5d9e4bcae7" title="GDSL element type.">gdsl_element_t</a>
<a name="l00413"></a>00413 <a class="code" href="group__gdsl__hash.html#gab8713e392d660458f514a8489c25c7c0" title="Search for a particular element into a hashtable (GET).">gdsl_hash_search</a> (<span class="keyword">const</span> gdsl_hash_t H,
<a name="l00414"></a>00414           <span class="keyword">const</span> <span class="keywordtype">char</span>* KEY
<a name="l00415"></a>00415           );
<a name="l00416"></a>00416 
<a name="l00417"></a>00417 <span class="comment">/******************************************************************************/</span>
<a name="l00418"></a>00418 <span class="comment">/* Parse functions of hashtables                                              */</span>
<a name="l00419"></a>00419 <span class="comment">/******************************************************************************/</span>
<a name="l00420"></a>00420 
<a name="l00436"></a>00436 <span class="keyword">extern</span> <a class="code" href="group__gdsl__types.html#ga0e2b9d7fb5ca9e6d50100e5d9e4bcae7" title="GDSL element type.">gdsl_element_t</a>
<a name="l00437"></a>00437 <a class="code" href="group__gdsl__hash.html#gafde50a811a8f52eed47573385ddf2a20" title="Parse a hashtable.">gdsl_hash_map</a> (<span class="keyword">const</span> gdsl_hash_t H,
<a name="l00438"></a>00438            <a class="code" href="group__gdsl__types.html#ga2500bfaaec5df890e72b43f448f13ee8" title="GDSL Map element function type.">gdsl_map_func_t</a> MAP_F,
<a name="l00439"></a>00439            <span class="keywordtype">void</span>* USER_DATA
<a name="l00440"></a>00440            );
<a name="l00441"></a>00441 
<a name="l00442"></a>00442 <span class="comment">/******************************************************************************/</span>
<a name="l00443"></a>00443 <span class="comment">/* Input/output functions of hashtables                                       */</span>
<a name="l00444"></a>00444 <span class="comment">/******************************************************************************/</span>
<a name="l00445"></a>00445 
<a name="l00461"></a>00461 <span class="keyword">extern</span> <span class="keywordtype">void</span>
<a name="l00462"></a>00462 <a class="code" href="group__gdsl__hash.html#ga00a73b21261010787c00d33d086ad7b2" title="Write all the elements of a hashtable to a file.">gdsl_hash_write</a> (<span class="keyword">const</span> gdsl_hash_t H,
<a name="l00463"></a>00463          <a class="code" href="group__gdsl__types.html#gafc7394b6c8e0a5bd92df75e24512dfd6" title="GDSL Write element function type.">gdsl_write_func_t</a> WRITE_F,
<a name="l00464"></a>00464          FILE* OUTPUT_FILE,
<a name="l00465"></a>00465          <span class="keywordtype">void</span>* USER_DATA
<a name="l00466"></a>00466          );
<a name="l00467"></a>00467 
<a name="l00484"></a>00484 <span class="keyword">extern</span> <span class="keywordtype">void</span>
<a name="l00485"></a>00485 <a class="code" href="group__gdsl__hash.html#ga9b7fa22eac1c348b8b21c0136f44dcc2" title="Write the content of a hashtable to a file into XML.">gdsl_hash_write_xml</a> (<span class="keyword">const</span> gdsl_hash_t H,
<a name="l00486"></a>00486              <a class="code" href="group__gdsl__types.html#gafc7394b6c8e0a5bd92df75e24512dfd6" title="GDSL Write element function type.">gdsl_write_func_t</a> WRITE_F,
<a name="l00487"></a>00487              FILE* OUTPUT_FILE,
<a name="l00488"></a>00488              <span class="keywordtype">void</span>* USER_DATA
<a name="l00489"></a>00489              );
<a name="l00490"></a>00490 
<a name="l00507"></a>00507 <span class="keyword">extern</span> <span class="keywordtype">void</span>
<a name="l00508"></a>00508 <a class="code" href="group__gdsl__hash.html#ga22b2515584dca1ab91f391602f4f4eeb" title="Dump the internal structure of a hashtable to a file.">gdsl_hash_dump</a> (<span class="keyword">const</span> gdsl_hash_t H,
<a name="l00509"></a>00509         <a class="code" href="group__gdsl__types.html#gafc7394b6c8e0a5bd92df75e24512dfd6" title="GDSL Write element function type.">gdsl_write_func_t</a> WRITE_F,
<a name="l00510"></a>00510         FILE* OUTPUT_FILE,
<a name="l00511"></a>00511         <span class="keywordtype">void</span>* USER_DATA
<a name="l00512"></a>00512         );
<a name="l00513"></a>00513 
<a name="l00514"></a>00514 <span class="comment">/*</span>
<a name="l00515"></a>00515 <span class="comment"> * @}</span>
<a name="l00516"></a>00516 <span class="comment"> */</span>
<a name="l00517"></a>00517 
<a name="l00518"></a>00518 
<a name="l00519"></a>00519 <span class="preprocessor">#ifdef __cplusplus</span>
<a name="l00520"></a>00520 <span class="preprocessor"></span>}
<a name="l00521"></a>00521 <span class="preprocessor">#endif </span><span class="comment">/* __cplusplus */</span>
<a name="l00522"></a>00522 
<a name="l00523"></a>00523 
<a name="l00524"></a>00524 <span class="preprocessor">#endif </span><span class="comment">/* _GDSL_HASH_H_ */</span>
<a name="l00525"></a>00525 
<a name="l00526"></a>00526 
</pre></div></div><!-- contents -->
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="gdsl__hash_8h.html">gdsl_hash.h</a>      </li>

    <li class="footer">Generated on Wed Jun 12 2013 18:18:47 for gdsl by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.6.1 </li>
   </ul>
 </div>


</body>
</html>
